Skip to content

emu: 实例声音开关,截图存到「图片\ModAVD」 - #188

Merged
qiyinxi merged 2 commits into
ModAVD:mainfrom
qiyinxi:feat/audio-savepath-226
Nov 17, 2026
Merged

qiyinxi merged 2 commits into
ModAVD:mainfrom
qiyinxi:feat/audio-savepath-226

Conversation

@qiyinxi

@qiyinxi qiyinxi commented Nov 17, 2026

Copy link
Copy Markdown
Member

Refs ModAVD/ModAVD#226
Refs ModAVD/ModAVD#231

声音(#226)

  • 实例设置加「声音」开关,存在 mas-avd.json 的 instances.<i>.sound,默认关;没写或不是 true 都按关算。
  • 关的时候开机参数和现在完全一样。开了以后,带窗口和无头开机都不再带 -audio none 和 -feature -VirtioSndCard。
  • config.ini 的 hw.audioInput / hw.audioOutput 跟开关一起写 yes / no。只改声音时只写这两个键和 sound,不重新校验、不重写内存、核数和数据盘(和诊断开关一样),老实例也能直接开。
  • 能改的地方:设置页开关(说明「开了会多占一些 CPU」,具体数字实测后补)、modavd set <i> --sound on|off、JSON 的 config.sound、PATCH /api/instances/{i} 和 MCP update_instance 的 sound。
  • changelog:changelog.d/226-sound.feat.md。

截图保存位置(#231)

  • 每次开机传 -save-path <图片>\ModAVD,开机前建好目录。Windows 用 SHGetKnownFolderPath(FOLDERID_Pictures);其他平台用 ~/Pictures/ModAVD(~/Pictures 存在时)。拿不到或建不了就不传,只记一条警告,模拟器用它自己的默认位置。
  • -save-path 是官方模拟器原有的参数,旧版模拟器也认。

测试

  • gofmt、go vet ./...(windows、darwin/arm64、linux/amd64)、go test ./... 全过;node --test scripts/*.mjs 77 个全过。
  • 开机参数是所有实例都走的主路径,做了变异检查:15 个变体(开关判断删掉、默认改成开、开机不读开关、-save-path 不传、不建目录、不写 hw.audio* / sound、只改声音的轻路径去掉或条件写错等)都被单测抓到。
  • 测试里的「图片」文件夹都注入成临时目录。
  • 实机测试放到这一版的发版回归里一起做(声音能出、CPU 多占多少、开了以后系统有没有提示麦克风在用、截图落到「图片\ModAVD」)。

- Instance setting "sound" (mas-avd.json instances.<i>.sound, off by default). Off boots exactly as before; on leaves
  out -audio none and -feature -VirtioSndCard, windowed and headless, and writes hw.audioInput / hw.audioOutput yes
  (no when off). Settable from the settings page, `modavd set <i> --sound on|off`, the API (PATCH sound) and MCP
  update_instance; shown as config.sound and in `info`.
- Every boot passes -save-path <Pictures>\ModAVD (FOLDERID_Pictures on Windows, ~/Pictures elsewhere), created
  first; left out when the folder is unknown or cannot be made.

Refs ModAVD/ModAVD#226
Refs ModAVD/ModAVD#231
Changing only the sound switch no longer validates or rewrites memory,
cores or the data disk (like the diagnostics switch), so an old 8 GB
instance can turn sound on and AUTO-MAS's automatic memory stays.

Refs ModAVD/ModAVD#226
@qiyinxi qiyinxi added enhancement New feature or request platform:windows 与 Windows 平台相关 labels Nov 17, 2026
@qiyinxi
qiyinxi added this pull request to the merge queue Nov 17, 2026
Merged via the queue into ModAVD:main with commit e822a1f Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request platform:windows 与 Windows 平台相关

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant